package com.ly.heart.service.impl;

import java.util.List;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import org.springframework.stereotype.Service;
import com.ly.heart.mapper.ProjectIndustryMapper;
import com.ly.heart.domain.ProjectIndustryEntity;
import com.ly.heart.service.IProjectIndustryService;

import javax.annotation.Resource;

/**
 * 项目所属行业Service业务层处理
 *
 * @author cxl
 * @date 2024-05-14
 */
@Service
public class ProjectIndustryServiceImpl implements IProjectIndustryService {

    @Resource
    private ProjectIndustryMapper projectIndustryMapper;

    /**
     * 查询项目所属行业
     *
     * @param id 项目所属行业主键
     * @return 项目所属行业
     */
    @Override
    public ProjectIndustryEntity selectIndustryEntityById ( String id ) {
        return projectIndustryMapper.selectIndustryEntityById ( id );
    }

    /**
     * 查询项目所属行业列表
     *
     * @param projectIndustryEntity 项目所属行业
     * @return 项目所属行业
     */
    @Override
    public List<ProjectIndustryEntity> selectIndustryEntityList ( ProjectIndustryEntity projectIndustryEntity ) {
        return projectIndustryMapper.selectIndustryEntityList ( projectIndustryEntity );
    }

    /**
     * 新增项目所属行业
     *
     * @param projectIndustryEntity 项目所属行业
     * @return 结果
     */
    @Override
    public int insertIndustryEntity ( ProjectIndustryEntity projectIndustryEntity ) {
        projectIndustryEntity.setId ( SnowflakeIdWorker.getInstance ().nextStringId () );
        projectIndustryEntity.setCreateTime ( DateUtils.getNowDate () );
        return projectIndustryMapper.insertIndustryEntity ( projectIndustryEntity );
    }

    /**
     * 修改项目所属行业
     *
     * @param projectIndustryEntity 项目所属行业
     * @return 结果
     */
    @Override
    public int updateIndustryEntity ( ProjectIndustryEntity projectIndustryEntity ) {
        projectIndustryEntity.setChangeTime ( DateUtils.getNowDate () );
        return projectIndustryMapper.updateIndustryEntity ( projectIndustryEntity );
    }

    /**
     * 批量删除项目所属行业
     *
     * @param ids 需要删除的项目所属行业主键
     * @return 结果
     */
    @Override
    public int deleteIndustryEntityByIds ( String[] ids ) {
        return projectIndustryMapper.deleteIndustryEntityByIds ( ids );
    }

    /**
     * 删除项目所属行业信息
     *
     * @param id 项目所属行业主键
     * @return 结果
     */
    @Override
    public int deleteIndustryEntityById ( String id ) {
        return projectIndustryMapper.deleteIndustryEntityById ( id );
    }
}
